  var LunarCalendarDay = function () {
      this.CalendarData = new Array(20);
      this.madd = new Array(12);
      this.TheDate = new Date();
      this.monArray = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
      this.cYear;
      this.cMonth;
      this.cDay;
      this.cHour;
      this.cDateString;
      this.DateString;
  };
  LunarCalendarDay.prototype = {
      init: function () {
          this.CalendarData[0] = 0x41A95;
          this.CalendarData[1] = 0xD4A;
          this.CalendarData[2] = 0xDA5;
          this.CalendarData[3] = 0x20B55;
          this.CalendarData[4] = 0x56A;
          this.CalendarData[5] = 0x7155B;
          this.CalendarData[6] = 0x25D;
          this.CalendarData[7] = 0x92D;
          this.CalendarData[8] = 0x5192B;
          this.CalendarData[9] = 0xA95;
          this.CalendarData[10] = 0xB4A;
          this.CalendarData[11] = 0x416AA;
          this.CalendarData[12] = 0xAD5;
          this.CalendarData[13] = 0x90AB5;
          this.CalendarData[14] = 0x4BA;
          this.CalendarData[15] = 0xA5B;
          this.CalendarData[16] = 0x60A57;
          this.CalendarData[17] = 0x52B;
          this.CalendarData[18] = 0xA93;
          this.CalendarData[19] = 0x40E95;
          this.madd[0] = 0;
          this.madd[1] = 31;
          this.madd[2] = 59;
          this.madd[3] = 90;
          this.madd[4] = 120;
          this.madd[5] = 151;
          this.madd[6] = 181;
          this.madd[7] = 212;
          this.madd[8] = 243;
          this.madd[9] = 273;
          this.madd[10] = 304;
          this.madd[11] = 334;
      },
      GetBit: function (m, n) {
          return (m >> n) & 1;
      },
      e2c: function () {
          var total, m, n, k;
          var isEnd = false;
          var tmp = this.TheDate.getYear();
          if (tmp < 1900) tmp += 1900;
          total = (tmp - 2001) * 365 + Math.floor((tmp - 2001) / 4) + this.madd[this.TheDate.getMonth()] + this.TheDate.getDate() - 23;
          if (this.TheDate.getYear() % 4 == 0 && this.TheDate.getMonth() > 1)
              total++;
          for (m = 0;; m++) {
              k = (this.CalendarData[m] < 0xfff) ? 11 : 12;
              for (n = k; n >= 0; n--) {
                  if (total <= 29 + this.GetBit(this.CalendarData[m], n)) {
                      isEnd = true;
                      break;
                  }
                  total = total - 29 - this.GetBit(this.CalendarData[m], n);
              }
              if (isEnd) break;
          }
          this.cYear = 2001 + m;
          this.cMonth = k - n + 1;
          this.cDay = total;
          if (k == 12) {
              if (this.cMonth == Math.floor(this.CalendarData[m] / 0x10000) + 1)
                  this.cMonth = 1 - this.cMonth;
              if (this.cMonth > Math.floor(this.CalendarData[m] / 0x10000) + 1)
                  this.cMonth--;
          }
          this.cHour = Math.floor((this.TheDate.getHours() + 3) / 2);
      },
      GetcDateString: function () {
          var tmp = this.TheDate.getFullYear() + '';
          if (this.cMonth < 1) {
              tmp += this.monArray[-this.cMonth - 1];
              tmp += '30';
          } else {
              tmp += this.monArray[this.cMonth - 1];
              tmp += (this.cDay < 10) ? ('0' + this.cDay) : this.cDay;
          }

          this.cDateString = tmp;
          return tmp;
      },
      GetDateString: function () {
          var tmp = "";
          var month = this.TheDate.getMonth() + 1;
          month = month < 10 ? ('0' + month) : month;
          var day = this.TheDate.getDate()
          day = day < 10 ? ('0' + day) : day;
          var t1 = this.TheDate.getFullYear();
          tmp += t1 + '' + month + '' + day
          this.DateString = tmp;
          return tmp;
      }
  }
  var lunarCalendarDay = new LunarCalendarDay();
  lunarCalendarDay.init();
  lunarCalendarDay.e2c();
  lunarCalendarDay.GetDateString();
  lunarCalendarDay.GetcDateString();

  export {
      lunarCalendarDay
  };